import { createRouter, createWebHistory } from 'vue-router'
import ACCESS_ENUM from '@/access/accessEnum'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '主页',
      component: import('@/views/HomePage.vue'),
    },
    {
      path: '/manage/userManage',
      name: '用户管理',
      component: import('@/views/manage/UserManagePage.vue'),
    },
    {
      path: '/manage/pictureManage',
      name: '图片管理',
      component: import('@/views/manage/PictureManagePage.vue'),
    },

    {
      path: '/manage/spaceManage',
      name: '空间管理',
      component: import('@/views/manage/SpaceManagePage.vue'),
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/user/login',
      name: '用户登录',
      component: import('@/views/user/UserLoginPage.vue'),
      meta: {
        hideInMenu: true,
      },
    },
    {
      path: '/user/register',
      name: '用户注册',
      component: import('@/views/user/UserRegisterPage.vue'),
      meta: {
        hideInMenu: true,
      },
    },
    {
      path: '/add_picture',
      name: '创建图片',
      component: import('@/views/picture/AddPicturePage.vue'),
      meta: {
        hideInMenu: true,
      },
    },
    {
      path: '/picture/:id',
      name: '图片详情',
      component: import('@/views/picture/PictureDetailPage.vue'),
      props: true,
      meta: {
        hideInMenu: true,
      },
    },
  ],
})

export default router
